package cn.ggsaas.base.util;

/**
 * @author liyuzhen
 * date 2020-08-31
 */
public class StrUtil extends cn.hutool.core.util.StrUtil {


    public static final String VERIFY_EMAIL = "^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})$";
    public static final String VERIFY_PHONE = "^(13[0-9]|15[0-9]|153|15[6-9]|180|18[23]|18[5-9])\\d{8}$";

    /**
     * 判断是否为邮箱
     *
     * @param str str
     * @return r
     */
    public static Boolean isEmail(String str) {
        return str.matches(VERIFY_EMAIL);
    }

    /**
     * 判断是否是手机号
     *
     * @param str str
     * @return r
     */
    public static boolean isPhone(String str) {
        return str.matches(VERIFY_PHONE);
    }

    public static void main(String[] args) {
        System.out.println(StrUtil.isPhone("wuhaihua@yuanmousoft.com"));
    }
}
